feat: add safe configurable iOS HTTP logging - #223
Merged
Conversation
Route Ktor logs through Kermit, support runtime log levels, and redact authentication and cookie headers.
Route iOS Ktor output to the captured console and sanitize authentication headers. Redact OAuth tokens, authorization codes, and PKCE verifiers from verbose request and response bodies.
ahmedre
approved these changes
Jul 29, 2026
ahmedre
reviewed
Jul 29, 2026
| level = if (config.environment.enableVerboseLogging) LogLevel.ALL else LogLevel.NONE | ||
| sanitizeHeader { header -> | ||
| header.equals(HttpHeaders.Authorization, ignoreCase = true) || | ||
| header.equals(HttpHeaders.Cookie, ignoreCase = true) || |
Contributor
There was a problem hiding this comment.
Do we ever send a cookie header?
Collaborator
Author
There was a problem hiding this comment.
I let codex search the code and couldn't find any uses, seems like a defensive mechanism. Here is what it said:
Not currently. This client doesn’t configure cookie storage or set a Cookie header. The browser-based OAuth flow may use cookies independently, but those requests don’t pass through this logger. I included Cookie and Set-Cookie as defense-in-depth in case the server returns one or cookie handling is added later.
mohamede1945
marked this pull request as ready for review
July 29, 2026 23:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MOBILE_SYNC_HTTP_LOG_LEVEL(ALL,BODY,HEADERS,INFO, orNONE).x-auth-tokenheaders.Why
KMP API traffic was difficult to inspect from the iOS example app because the prior logger did not reach the captured console. Enabling verbose OAuth logging also exposed credentials, so debugging must remain safe by default.
Validation
./gradlew :auth:allTests./gradlew :syncengine:allTestsmobile-sync-spmin the QuranEngine example app.